<template>
  <el-container>
    <el-header style="margin: 10px">
      <el-page-header @back="goBack" :title="title" style="color: #4490f1"/>
    </el-header>
    <el-main style="margin: 10px">
      <el-table :data="tableData" style="width: 100%;margin-bottom: 10px" :cell-style="cellStyle">
        <el-table-column prop="id" label="提交编号" />
        <el-table-column prop="submitName" label="用户名" />
        <el-table-column prop="submitNick" label="昵称" />
        <el-table-column prop="titleId" label="题目编号" />
        <el-table-column prop="titleResult" label="结果" />
        <el-table-column prop="mem" label="内存/KiB" />
        <el-table-column prop="time" label="时间/ms" />
        <el-table-column prop="languageId" label="语言" />
        <el-table-column prop="titleTime" label="提交时间" />
      </el-table>
      <el-input
          v-model="textarea"
          :autosize="{ minRows: 2, maxRows: 20 }"
          type="textarea"
      />
    </el-main>
  </el-container>
</template>

<script>
import request from "@/utils/request";

export default {
  name: "StatusDetailsView",
  props:['tId'],
  data(){
    return{
      tId:{},
      textarea:'',
      dialogVisible: false,
      tableData: []
    }
  },
  created() {
    this.tId = this.$route.query.tId;
    this.load(this.tId);
  },
  methods:{
    goBack() {
      this.$router.push('/status')
    },
    load(id) {
      request.get("/submitRecord/" + id).then(res => {
        console.log(res.data)
        this.tableData = res.data.records
        this.textarea = res.data.records[0].sourceCode
      })
    },
  }
}
</script>

<style scoped>
.el-button {
  margin: 10px 10px 10px 10px;
}
.el-header{
  height: 20px;
}
.el-row {
  margin-bottom: 20px;
}
.el-row:last-child {
  margin-bottom: 0;
}
.el-col {
  border-radius: 4px;
}

.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
</style>